procedure sort( var r : ArrayToSort; lo, up : integer );
var i, j : integer;
r1 : ArrayToSort;
begin
r1 := r;
for j:=lo to UppBoundr do r[j].k := NoKey;
for j:=lo to up do begin
i := phi(r1[j].k,lo,m);
while r[i].k <> NoKey do begin
if r1[j].k < r[i].k then begin
r1[j-1] := r[i];
r[i] := r1[j];
r1[j] := r1[j-1]
end;
i := i+1;
if i > UppBoundr then Error
end;
r[i] := r1[j]
end;
i := lo-1;
for j:=lo to UppBoundr do
if r[j].k <> NoKey then begin
i := i+1;
r[i] := r[j]
end;
for j:=i+1 to UppBoundr do r[j].k := NoKey;
end;
|